package com.example.binder;

import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;

public class ClientDemo {
    public static void main(String[] args) {
        System.out.println("Client start");
        //获取TestService服务
        IBinder binder = ServiceManager.getService("TestService");
        //创建TestServiceProxy对象
        ITestService service = new TestServiceProxy(binder);
        //通过TestServiceProxy对象调用接口的方法
        try {
            service.test(1);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        System.out.println("Client end");
    }
}
